package o;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.List;
import javax.annotation.Nullable;
import javax.net.ssl.SSLParameters;
import javax.net.ssl.SSLSocket;

final class fwr extends fwy {
    final Method ˋ;
    final Method ˎ;

    fwr(Method method, Method method2) {
        this.ˎ = method;
        this.ˋ = method2;
    }

    public void ॱ(SSLSocket sSLSocket, String str, List<fut> list) {
        Exception e;
        try {
            SSLParameters sSLParameters = sSLSocket.getSSLParameters();
            List ˎ = fwy.ˎ(list);
            this.ˎ.invoke(sSLParameters, new Object[]{ˎ.toArray(new String[ˎ.size()])});
            sSLSocket.setSSLParameters(sSLParameters);
        } catch (IllegalAccessException e2) {
            e = e2;
            throw fvg.ॱ("unable to set ssl parameters", e);
        } catch (InvocationTargetException e3) {
            e = e3;
            throw fvg.ॱ("unable to set ssl parameters", e);
        }
    }

    @Nullable
    public String ˊ(SSLSocket sSLSocket) {
        Exception e;
        try {
            String str = (String) this.ˋ.invoke(sSLSocket, new Object[0]);
            if (str == null || str.equals("")) {
                return null;
            }
            return str;
        } catch (IllegalAccessException e2) {
            e = e2;
            throw fvg.ॱ("unable to get selected protocols", e);
        } catch (InvocationTargetException e3) {
            e = e3;
            throw fvg.ॱ("unable to get selected protocols", e);
        }
    }

    public static fwr ˊ() {
        try {
            return new fwr(SSLParameters.class.getMethod("setApplicationProtocols", new Class[]{String[].class}), SSLSocket.class.getMethod("getApplicationProtocol", new Class[0]));
        } catch (NoSuchMethodException e) {
            return null;
        }
    }
}
